<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
	<meta charset="utf-8"> 
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=500" />
	<meta name="keywords" content="ScrollMagic, example, scrolling, attaching, scrollbar, anchor, link, in-page, navigation, hash" />
	<meta name="author"	content="Jan Paepke (www.janpaepke.de)" />
	<title>Section Slides (manual) - Examples - ScrollMagic</title>

	<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic|Josefin+Slab:400,700italic' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="../../assets/css/normalize.css" type="text/css">
	<link rel="stylesheet" href="../../assets/css/style.css" type="text/css">
	<link rel="stylesheet" href="../../assets/css/examples.css" type="text/css">
	<link rel="shortcut icon" href="../../assets/img/favicon.ico" type="image/x-icon">

	<script type="text/javascript" src="../../assets/js/lib/jquery.min.js"></script>
	<script type="text/javascript" src="../../assets/js/lib/highlight.pack.js"></script>
	<script type="text/javascript" src="../../assets/js/lib/modernizr.custom.min.js"></script>
	<script type="text/javascript" src="../../assets/js/examples.js"></script>
	
	<script type="text/javascript" src="../../assets/js/lib/gsap3/gsap.min.js"></script>
	<script type="text/javascript" src="../../scrollmagic/uncompressed/ScrollMagic.js"></script>
	<script type="text/javascript" src="../../scrollmagic/uncompressed/plugins/animation.gsap.js"></script>
	<script type="text/javascript" src="../../scrollmagic/uncompressed/plugins/debug.addIndicators.js"></script>
</head>
<body>
	<ul id="menu"></ul>
	<div id="content-wrapper">
		<div id="example-wrapper">
			<div class="scrollContent">
				<section id="titlechart">
					<div id="description">
						<h1 class="badge gsap">Section Slides (manual)</h1>
						<h2>Slide in your content with custom movements</h2>
						<p>Similar to the <a href="../advanced/section_wipes_manual.html">Section Wipe example</a> you need to create a container with the size of the viewport and pin it.</p>
						<p>Now you can create custom animations to present your content and bind them to the scroll position.</p>
						<p>In this example an additional 3D effect is used just for shits and giggles, but of course you could just as well have a continuous left-to-right movement only (or any other movement for that matter).</p>
						<a href="#" class="viewsource">view source</a>
					</div>
				</section>
				<section class="demo" id="section-slides">
					<style type="text/css">
						#pinContainer {
							width: 100%;
							height: 100%;
							overflow: hidden;
							-webkit-perspective: 1000;
							        perspective: 1000;
						}
						#slideContainer {
							width: 400%; /* to contain 4 panels, each with 100% of window width */
							height: 100%;
						}
						.panel {
							height: 100%;
							width: 25%; /* relative to parent -> 25% of 400% = 100% of window width */
							float: left;
						}
					</style>
					<div id="pinContainer">
						<div id="slideContainer">
							<section class="panel blue">
								<b>ONE</b>
							</section>
							<section class="panel turqoise">
								<b>TWO</b>
							</section>
							<section class="panel green">
								<b>THREE</b>
							</section>
							<section class="panel bordeaux">
								<b>FOUR</b>
							</section>
						</div>
					</div>
					<script>
						$(function () { // wait for document ready
							// init
							var controller = new ScrollMagic.Controller();

							// define movement of panels
							var wipeAnimation = new TimelineMax()
								// animate to second panel
								.to("#slideContainer", 0.5, {z: -150})		// move back in 3D space
								.to("#slideContainer", 1,   {x: "-25%"})	// move in to first panel
								.to("#slideContainer", 0.5, {z: 0})				// move back to origin in 3D space
								// animate to third panel
								.to("#slideContainer", 0.5, {z: -150, delay: 1})
								.to("#slideContainer", 1,   {x: "-50%"})
								.to("#slideContainer", 0.5, {z: 0})
								// animate to forth panel
								.to("#slideContainer", 0.5, {z: -150, delay: 1})
								.to("#slideContainer", 1,   {x: "-75%"})
								.to("#slideContainer", 0.5, {z: 0});

							// create scene to pin and link animation
							new ScrollMagic.Scene({
									triggerElement: "#pinContainer",
									triggerHook: "onLeave",
									duration: "500%"
								})
								.setPin("#pinContainer")
								.setTween(wipeAnimation)
								.addIndicators() // add indicators (requires plugin)
								.addTo(controller);
						});
					</script>
				</section>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="../../assets/js/tracking.js"></script>
</body>
</html>
